<template>
  <div class="create">
    <header>
      <i class="iconfont icon-angle-left"></i>
      <h3>创建直播</h3>
      <p>
        <i class="iconfont icon-gengduo"></i>
        <i class="iconfont icon-play1"></i>
      </p>
    </header>
    <main>
      <div class="addLive">
        <div class="center">
          <van-uploader preview-size='260px' v-model="fileList" multiple :max-count="1">
            <h1>+</h1>
            <p>添加直播封面图</p>
          </van-uploader>
        </div>
      </div>
      <div class="live_title">
        <input type="text" v-model="value" placeholder="请输入直播主题" name="" id="" />
      </div>
    </main>
    <footer>
      <button @click="openLive">开启直播</button>
    </footer>
  </div>
</template>

<script>
export default {
  data () {
    return {
      fileList: [],
      value: ''
    }
  },
  methods: {
    openLive () {
      if (this.value !== '') {
        this.$router.go('/live')
      } else {
        alert('输入内容不能为空！！！')
      }
    }
  }
}
</script>

<style scoped lang='scss'>
.create {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  header {
    width: 100%;
    height: 45px;
    background-color: skyblue;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 10px;
    color: #fff;
    h3 {
      font-weight: normal;
    }
    p {
      width: 80px;
      padding: 2px 10px;
      display: flex;
      justify-content: space-around;
      border: 1px solid #eee;
      border-radius: 15px;
    }
  }
}
main {
  flex: 1;
  overflow-y: scroll;
  background-color: #eee;
}
.addLive {
  width: 98%;
  height: 260px;
  border: 1px solid #ccc;
  text-align: center;
  margin: 10px auto;
  background-color: #fff;
  .center {
    width: 100%;
    height: 100%;
    margin: 0 auto;
    h1 {
      line-height: 150px;
      color: #999;
    }
  }
  .van-uploader__wrapper{
    width: 100%;
    height: 300px;
  }
}
.live_title {
  width: 98%;
  height: 45px;
  margin: 0 auto;
  input {
    width: 100%;
    height: 100%;
    padding-left: 10px;
  }
}
footer {
  width: 100%;
  height: 45px;
  button {
    width: 100%;
    height: 45px;
    color: #fff;
    outline: none;
    border: none;
    background-color: skyblue;
  }
}
</style>
